package com.example.covid19.mapper;

import com.example.covid19.common.Dto.ChanbedDto;
import com.example.covid19.entity.Chanbed;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author BaiZhengChun
 * @since 2023-04-03
 */
public interface ChanbedMapper extends BaseMapper<Chanbed> {
    @Select("SELECT " +
            " chanbed.*, " +
            " room.rid AS rrid, " +
            " student.`name` " +
            "FROM " +
            " room " +
            " INNER JOIN " +
            " chanbed " +
            " ON " +
            " room.id = chanbed.rid " +
            " INNER JOIN " +
            " student " +
            " ON " +
            " chanbed.studentid = student.studentid " +
            "WHERE " +
            " chanbed.auid = #{auid} AND " +
            " chanbed.process = 0 ")
    List<ChanbedDto> getChanbedInfo(@Param("auid") Integer auid);

}
